<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script type="text/html" id="tpl-user">
        <div>姓名：{{name}}</div>
        <div>年龄：{{ age }}</div>
        <div>性别：{{  gender}}</div>
        <div>住址：{{address  }}</div>
    </script>
</head>

<body>
    <div id="info"></div>
    <script src="my-template.js"></script>
    <script type="text/Javascript">
var data = 
{ name: 'cc', 
age: 28, 
gender: '男', 
address: '你个我' }
var res = myTemplate('tpl-user', data)
document.getElementById('info').innerHTML = res
    
    </script>
</body>

</html>